<?php
    if (isset($_GET['a']))
    {
        require_once 'src/website/model/model_authentication.php';
        $action = $_GET['a'];
        switch ($action)
        {
            case 'login':
                $isLogOk = login();
                $errorMessage = ($isLogOk ? '' : '<p id="wrongId">Identifiants incorrects.</p>');
                break;
            case 'logout':
                logout();
                break;
            default:
                require_once 'src/website/controller/controller_home.php';
                break;
        }
    }
    else
    {
        if (!isset($errorMessage))
        {
            $errorMessage = '<p>Veuillez entrer vos identifiants.</p>';
        }
    }
    require_once 'src/website/view/view_authentication.php';
?>